<template>
    <div>
        <Button @click="download" :disabled="prohibit" >下载</Button>
    </div>
</template>

<script>
export default {
    name: 'DownloadButton',
    props:{
        downData: null,
    },
    data(){
        return {
            prohibit: false,
        }
    },
    created(){
        if(this.downData){
            this.prohibit = false
        }else{
            this.prohibit = true
        }
    },
    watch:{
    "downData"(){
        if(this.downData){
            this.prohibit = false
        }else{
            this.prohibit = true
        }
    }
    },
    methods: {
        download(){
            if(this.downData){
                this.$Message.success('正在下载文件')
                window.open(this.downData)
            }else{
                this.$Message.error('此项暂无上传文件')
            }
        }
    }
}
</script>

<style>

</style>
